package com.example.administrator.xxnapp.login;

import com.example.administrator.xxnapp.http.CustomStringCallback;
import com.example.administrator.xxnapp.http.ResultStringCallback;
import com.google.gson.Gson;

/**
 * Created by Administrator on 2018/5/18.
 */

public class PasswordPresenter {
    private IViewPassword mIView;
    private IModelPassword mIModel;

    public PasswordPresenter(IViewPassword mIView, IModelPassword mIModel) {
        this.mIView = mIView;
        this.mIModel = mIModel;
    }

    public void updatePassword(String username,String password){
        mIModel.updatePassword(username,password)
                .execute(new ResultStringCallback() {
                    @Override
                    public void onResultSuccess(Gson gson, String dataJsonStr) {
                        mIView.updatePasswordSuccess();
                    }

                    @Override
                    public void onResultOther(int result, String message) {
                        mIView.updatePasswordError(result,message);
                    }
                });
    }
}
